package routes

import (
	"agent-list---web-development/list/controller"
	"agent-list---web-development/list/middleware"
	routinecontroller "agent-list---web-development/list/routine_controller"

	"github.com/gin-gonic/gin"
)

// 路由信息
func CollectRouter(r *gin.Engine) *gin.Engine {
	r.Use(middleware.CORSMiddleware())
	r.GET("/api/info", middleware.AuthMiddleware(), controller.Info)
	r.POST("/api/register", controller.Register)
	r.POST("/api/login", controller.Login)
	r.PUT("/api/modifyusername", controller.ModifyName)
	r.PUT("/api/modifypassword", controller.ModifyPassword)
	r.PUT("/api/modifyavatar", controller.ModifyAvatar)
	r.POST("api/task", controller.CreateTask)

	r.POST("/api/createRoutine", routinecontroller.CrearteRoutine)
	r.DELETE("/api/deleteRoutine", routinecontroller.DeleteRoutine)
	r.GET("/api/infoRoutine", routinecontroller.RoutineInfo)
	r.PUT("/api/modifyRoutine", routinecontroller.ModifyRoutine)
	r.GET("/api/showRoutine", routinecontroller.ShowRoutine)
	r.GET("/api/getrstime", routinecontroller.GetRoutinetime)

	r.POST("api/create", controller.CreateTask)
	r.PUT("api/edit", controller.EditTask)
	r.DELETE("api/delete", controller.DeleteTask)
	r.PUT("api/complete", controller.CompleteTask)
	r.POST("api/summary", controller.TaskSummary)
	r.GET("api/alltask", controller.GetAllTask)
	r.GET("/api/undotask", controller.GetUndoTask)
	r.GET("api/donetask", controller.GetDoneTask)
	r.GET("api/expiredtask", controller.GetExpiredTask)
	r.GET("api/searchbyday", controller.ShowTaskByDay)
	r.GET("api/searchbyweek", controller.ShowTaskByWeek)
	r.GET("api/searchbymonth", controller.ShowTaskByMonth)
	return r
}
